<template>
  <div id="app">
    <div class="main-header">
      <div>
        <router-link :to="{path:'/'}">
          <img src="./assets/top_logo.png">
        </router-link>
      </div>
      <div>
        <el-menu
          :default-active="activeIndex"
          class=""
          mode="horizontal"
          @select="handleSelect"
          background-color="#393d48"
          text-color="#fff"
          active-text-color="#ffd04b">
          <el-submenu index="1">
            <template slot="title">云教学</template>
            <el-menu-item index="1-1">课程</el-menu-item>
            <el-menu-item index="1-2">视频教学</el-menu-item>
            <el-menu-item index="1-3">模拟考试</el-menu-item>
          </el-submenu>
          <el-menu-item index="2">专家人才库</el-menu-item>
          <el-menu-item index="3">产品交付</el-menu-item>
          <el-menu-item index="4">校企合作</el-menu-item>
          <el-menu-item index="5">协会联盟</el-menu-item>
        </el-menu>
      </div>
      <div>
        <!--登录-->
        <div class="index-login">
          <div @click="login">登录</div>
          <div>创建免费账号</div>
        </div>
      </div>
    </div>
    <keep-alive>
      <router-view/>
    </keep-alive>
    <keep-alive>
      <app-login :is-show="isShowLogin" @close-popup="closePopup"></app-login>
    </keep-alive>
  </div>
</template>

<script>
  import login from '@/pages/login/login'
  export default {
    name: 'app',
    components: {
      appLogin: login
    },
    data() {
      return {
        activeIndex: '1',
        isShowLogin: false
      };
    },
    methods: {
      // 选择后回调
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      },
      // 登录
      login (){
        this.isShowLogin = !this.isShowLogin
      },
      // 关闭
      closePopup(){
        this.isShowLogin = false;
      }
    }
  }
</script>

<style>
  html, body, div, span, applet, object, iframe,
  h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  a, abbr, acronym, address, big, cite, code,
  del, dfn, em, img, ins, kbd, q, s, samp,
  small, strike, strong, sub, sup, tt, var,
  b, u, i, center,
  dl, dt, dd, ol, ul, li,
  fieldset, form, label, legend,
  table, caption, tbody, tfoot, thead, tr, th, td,
  article, aside, canvas, details, embed,
  figure, figcaption, footer, header, hgroup,
  menu, nav, output, ruby, section, summary,
  time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
  }

  article, aside, details, figcaption, figure,
  footer, header, hgroup, menu, nav, section {
    display: block;
  }

  body {
    line-height: 1;
  }

  ol, ul {
    list-style: none;
  }

  blockquote, q {
    quotes: none;
  }

  blockquote:before, blockquote:after,
  q:before, q:after {
    content: '';
    content: none;
  }

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  body {
    background: #f0f2f5;
    font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB", "Hiragino Sans GB W3", "Microsoft YaHei UI", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
    font-size: 14px;
    color: #444;
  }

  /*---ui 样式覆盖---*/
  .el-input__inner, .el-button {
    border-radius: 0;
  }

  /*--------------*/

  .main-header {
    height: 60px;
    box-sizing: border-box;
    background-color: #393d48;
  }

  .main-header > div {
    display: inline-block;
    margin-left: -5px;
    height: 100%;
    vertical-align: top;
  }

  .main-header > div:nth-child(1) {
    width: 25%;
  }

  .main-header > div:nth-child(1) img {
    margin-left: 35px;
    margin-top: 13px;
  }

  .main-header > div:nth-child(2) {
    width: 50%;
  }

  .main-header > div:nth-child(3) {
    width: 25%;
    text-align: end;
  }

  .index-login > div {
    color: #fff;
    text-align: center;
    display: inline-block;
    cursor: pointer;
    margin-right: 20px;
    webkit-transition: border-color .3s, background-color .3s, color .3s;
    transition: border-color .3s, background-color .3s, color .3s;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }

  .index-login > div:nth-child(1) {
    font-size: 15px;
    height: 100%;
    line-height: 60px;
    width: 100px;
  }

  .index-login > div:nth-child(1):hover {
    color: rgb(255, 255, 255);
    border-bottom-color: transparent;
    background-color: rgb(46, 49, 58);
  }

  .index-login > div:nth-child(2) {
    font-size: 14px;
    height: 32px;
    line-height: 32px;
    background-color: #f7c863;
    color: #393d48;
    width: 100px;
  }

  .index-login > div:nth-child(2):hover {
    background-color: #ffd04b;
  }
</style>
